<template>
    <div class="index">
        <div class="location">
            <img src="../../assets/img/7.png" alt=""/>
            <div>四川省成都市高新区天府大道南段325号</div>
        </div>
        <div class="banner">
            <img src="../../assets/img/8.png" alt=""/>
        </div>
        <div class="menu">
            <div class="menu-item-index" v-for="(i, j) in menu" :key="i.id" @click="nav(i, j)">
                <div class="menu-item-index-img">
                    <img v-if="j === (menu.length - 1)" src='../../assets/img/m9.png' alt=""/>
                    <img v-else :src='i.src' alt=""/>
                </div>
                <div class="menu-item-index-name">{{i.name}}</div>
            </div>
        </div>
        <div class="store">
            <div class="store-item">
                <div class="store-item-img">
                    <img src="../../assets/img/9.png" alt=""/>
                </div>
                <div class="store-item-info">
                    <div class="store-item-info-name">汉堡王(新世纪环球中心店)</div>
                    <div class="store-item-info-position">
                        <img src="../../assets/img/7.png" alt=""/>
                        <div>天府大道北段1700号新世纪环球中心B1层</div>
                    </div>
                </div>
                <div class="store-item-distance">554m</div>
            </div>
            <div class="store-item">
                <div class="store-item-img">
                    <img src="../../assets/img/9.png" alt=""/>
                </div>
                <div class="store-item-info">
                    <div class="store-item-info-name">汉堡王(新世纪环球中心店)</div>
                    <div class="store-item-info-position">
                        <img src="../../assets/img/7.png" alt=""/>
                        <div>天府大道北段1700号新世纪环球中心B1层</div>
                    </div>
                </div>
                <div class="store-item-distance">554m</div>
            </div>
            <div class="store-item">
                <div class="store-item-img">
                    <img src="../../assets/img/9.png" alt=""/>
                </div>
                <div class="store-item-info">
                    <div class="store-item-info-name">汉堡王(新世纪环球中心店)</div>
                    <div class="store-item-info-position">
                        <img src="../../assets/img/7.png" alt=""/>
                        <div>天府大道北段1700号新世纪环球中心B1层</div>
                    </div>
                </div>
                <div class="store-item-distance">554m</div>
            </div>
        </div>
        <div class="bottom-space"></div>
    </div>
</template>

<script>
    export default {
        name: 'index',
        data () {
            return {
                menu: [
                    {
                        id: 1,
                        name: '重庆火锅',
                        img: () => import('../../assets/img/m10.png')
                    },
                    {
                        id: 2,
                        name: '重庆火锅',
                        img: '../../assets/img/m10.png'
                    },
                    {
                        id: 3,
                        name: '重庆火锅',
                        img: '../../assets/img/m10.png'
                    },
                    {
                        id: 4,
                        name: '重庆火锅',
                        img: '../../assets/img/m10.png'
                    },
                    {
                        id: 5,
                        name: '重庆火锅',
                        img: '../../assets/img/m10.png'
                    },
                    {
                        id: 6,
                        name: '重庆火锅',
                        img: '../../assets/img/m10.png'
                    },
                    {
                        id: 7,
                        name: '重庆火锅',
                        img: '../../assets/img/m10.png'
                    },
                    {
                        id: 8,
                        name: '重庆火锅',
                        img: '../../assets/img/m10.png'
                    },
                    {
                        id: 9,
                        name: '重庆火锅',
                        img: '../../assets/img/m10.png'
                    },
                    {
                        id: 10,
                        name: '全部',
                        img: '../../assets/img/m9.png'
                    }
                ]
            }
        },
        methods:{
            nav (i, j) {
                console.log(i);
                if (j === (this.menu.length - 1)){
                    this.$router.push('Classify')
                }
            }
        }
    }
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped lang="scss">
    .index{
        background:rgba(240,241,247,1);
        .location{
            background-color: #ffffff;
            display: flex;
            height: 0.8rem;
            align-items: center;
            padding-left: 0.46rem;
            img{
                width: 0.19rem;
                height: 0.28rem;
                margin-right: 0.2rem;
            }
            >div{
                flex-grow: 1;
                font-size: 0.26rem;
                font-weight: 500;
                color: rgba(153, 153, 153, 1);
            }
        }
        .banner{
            background-color: #ffffff;
            text-align: center;
            height: 3.62rem;
            margin: 0 auto;
            img {
                width: 7.26rem;
                height: 100%;
            }
        }
        .menu{
            background-color: #ffffff;
            display: flex;
            flex-wrap: wrap;
            padding: 0 0.2rem 0.3rem 0.2rem;
            .menu-item-index{
                margin-top: 0.3rem;
                text-align: center;
                &-img{
                    width: 0.86rem;
                    height: 0.86rem;
                    margin: 0 auto;
                    img{
                        width: 100%;
                        height: 100%;
                    }
                }
                width: calc(100% / 5);
                &-name{
                    margin-top: 0.06rem;
                    font-size: 0.22rem;
                    font-weight: 500;
                    color: rgba(51, 51, 51, 1);
                }
            }
        }
        .store{
            background-color: #ffffff;
            margin-top: 0.2rem;
            padding: 0.2rem;
            &-item{
                display: flex;
                align-items: center;
                justify-content: space-between;
                width: 7.1rem;
                padding: 0.18rem 0.1rem;
                border-bottom: 0.01rem solid #EEEEEE;
                &-img{
                    width: 1.5rem;
                    height: 1.5rem;
                    img{
                        width: 100%;
                        height: 100%;
                    }
                }
                &-info{
                    width: 4rem;
                    &-name{
                        font-size: 0.32rem;
                        font-weight: bold;
                        color: rgba(3, 3, 3, 1);
                    }
                    &-position{
                        display: flex;
                        align-items: flex-start;
                        margin-top: 0.12rem;
                        img {
                            margin-top: 0.08rem;
                            width: 0.19rem;
                            height: 0.28rem;
                            margin-right: 0.1rem;
                        }
                        >div{
                            font-size: 0.24rem;
                            font-weight: 500;
                            color: rgba(102, 102, 102, 1);
                        }
                    }
                }
                &-distance{
                    width: 0.8rem;
                    font-size: 0.24rem;
                    font-weight: 500;
                    color: rgba(102, 102, 102, 1);
                }
            }

        }
        .bottom-space{
            height: 1.5rem;
        }
    }
</style>
